from django.shortcuts import render

# Create your views here.
from rest_framework.response import Response
from rest_framework.views import APIView

from .models import User


class RegisterUsernameCountAPIView(APIView):

    def get(self,request,username):
        # 1查询数据库
        count = User.objest.filter(username=username).count()
        # 2返回一个count
        data = {
            'count':count
        }
        return Response(data)
        pass